package com.ethink.system.converter;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import com.ethink.framework.common.converter.Converter;
import com.ethink.system.api.info.SystemUserInfo;
import com.ethink.system.common.entity.SystemUser;

/**
 * 系统用户表 Converter转换器
 *
 * @author default
 * @date 2022-09-23
 */
@Component
public class SystemUserConverter implements Converter<SystemUserInfo, SystemUser> {

    @Override
    public SystemUser convertTo(SystemUserInfo info) {
        if(info == null) {
            return null;
        }
        SystemUser entity = new SystemUser ();
        BeanUtils.copyProperties(info, entity);
        return entity;
    }

    @Override
    public SystemUserInfo convertFrom(SystemUser entity) {
        if(entity == null) {
            return null;
        }
        SystemUserInfo info = new SystemUserInfo();
        BeanUtils.copyProperties(entity, info);
        return info;
    }
}
